package day01;

import java.util.ArrayList;
import java.util.List;

/**
 * @author feng
 * @Date 2021/12/22 21:05
 * 类型通配符下限：父类或者实参类型
 */
public class Test02 {
    public static void main(String[] args) {
        ArrayList<Annimal> objects = new ArrayList<>();
        ArrayList<Cat> cats = new ArrayList<>();
        ArrayList<Mincat> mincats = new ArrayList<>();

        showAnimal(objects);
        showAnimal(cats);
        // showAnimal(mincats);

    }

    public static void showAnimal(List<? super Cat> list) {
        list.add(new Cat());
        for (Object o : list) {
            System.out.println(o);
        }
    }
}
